package com.vip.admin.modules.system.service.impl;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.vip.admin.modules.system.entity.SysResources;
import com.vip.admin.modules.system.mapper.SysResourcesMapper;
import com.vip.admin.modules.system.service.ISysResourcesService;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author 袜子离不开秋裤
 * @since 2020-01-13
 */
@Service
public class SysResourcesServiceImpl extends ServiceImpl<SysResourcesMapper, SysResources>
		implements ISysResourcesService {

	@Override
	public Set<String> getSysResourcesByUsername(String username) {
		List<SysResources> entitys = baseMapper.getSysResourcesByUsername(username);
		Set<String> permissionIdens = new HashSet<>();
		for (SysResources entity : entitys) {
			if (StringUtils.isNotBlank(entity.getPermissionIden()))
				permissionIdens.add(entity.getPermissionIden());
		}
		return permissionIdens;
	}

}
